UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mf9kY6aP4mNn/J9Ztw8s5rHax4qANl6SdeT45VQ121o=' 
WHERE 
  key_id = '2addc2d8100dccb3c27214284b7443020bee014129f1293ee0eca6ef2e76e9af' 
  AND (
    token = 'mf9kY6aP4mNn/J9Ztw8s5rHax4qANl6SdeT45VQ121o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025