UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4evU13xPDh7l/J/9Cv+AE/27OW3YBaH8rx0q80lXRDE=' 
WHERE 
  key_id = 'c2e498254faea7489aefc21ca4967115adf47486f9b946b17426fcbaa41b0917' 
  AND (
    token = '4evU13xPDh7l/J/9Cv+AE/27OW3YBaH8rx0q80lXRDE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046