UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'MS88U9Qrx9Snwp1tx0SpbyiPp19cFC49RFELeBdAGAw=' 
WHERE 
  key_id = '7aa20a4c431dee6c0f4acbea76627b8e4bb48e692465df5c11fb47bc0bbefc4f' 
  AND (
    token = 'MS88U9Qrx9Snwp1tx0SpbyiPp19cFC49RFELeBdAGAw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051