UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'i/wOUSWY693ImWumghk2Q6kbrfLD2CDBtrhih7KytHc=' 
WHERE 
  key_id = '4e35b9849c54ddd88dd84cfa5d712e1ff8a7228803d1fd1fa231156e9dfd6f49' 
  AND (
    token = 'i/wOUSWY693ImWumghk2Q6kbrfLD2CDBtrhih7KytHc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046