UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SNHI3gf9jsHZKTCUjJgEM7GMhX65zUvDy59GQHRdQTs=' 
WHERE 
  key_id = '00fe44b839fe156d917491ced2447a67af14420f21de15baa5382e4536c536c3' 
  AND (
    token = 'SNHI3gf9jsHZKTCUjJgEM7GMhX65zUvDy59GQHRdQTs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038