UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gWkoBeM98TiEks+gbln8cYqA/7iH7j9NBrZ5ZGLHCJk=' 
WHERE 
  key_id = '712e855a81cadaf71f254d4942d1c9c02c7159c28de41ca747bc56d4c4fd3b79' 
  AND (
    token = 'gWkoBeM98TiEks+gbln8cYqA/7iH7j9NBrZ5ZGLHCJk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052