UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rlkuWJc6gnnXcgy+xx3txTFPOo5tbjv+DGjV5eOX1c8=' 
WHERE 
  key_id = 'b352d24e7d95787e774b6358d57a7a84b88a91d6da171956546129976e2d055b' 
  AND (
    token = 'rlkuWJc6gnnXcgy+xx3txTFPOo5tbjv+DGjV5eOX1c8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00049