UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ceenX99tVsg1otAUGjPY+DaaZBR54t5LXU5iDBgAxWA=' 
WHERE 
  key_id = '181eb0be3dc07b2ca281b6489f8b7e1159233bbc6aabea8771d0acc843c3cb1a' 
  AND (
    token = 'ceenX99tVsg1otAUGjPY+DaaZBR54t5LXU5iDBgAxWA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023