UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dWFiJr/PtJQz7JsDTWMnZAms+2zgr9dTx7+UCsRcAyQ=' 
WHERE 
  key_id = 'c7fb9853ddde19ae387e8669728408c0c1a24d7db134909fd18f1695d9a31d33' 
  AND (
    token = 'dWFiJr/PtJQz7JsDTWMnZAms+2zgr9dTx7+UCsRcAyQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040