UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iTsIc6R3ozuKBQkDs+rc6QNBGP29jDqUCuaZ8BtMJBI=' 
WHERE 
  key_id = 'f9d02034ace8e5e00fb602f6772ad0acd543339bb43848266861ab8e8784f109' 
  AND (
    token = 'iTsIc6R3ozuKBQkDs+rc6QNBGP29jDqUCuaZ8BtMJBI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038