UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9vZL22ZYG909InyZgX/att3mlct6zc1c069F6oETMy8=' 
WHERE 
  key_id = '93919fdac501a674523d004c8b163039af9817c5b6f1a2c5c607243736a8e809' 
  AND (
    token = '9vZL22ZYG909InyZgX/att3mlct6zc1c069F6oETMy8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033