UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bniIwxMvAGlX+ucLSRNHENWjkrH/K2eaoN4JSoCVFUM=' 
WHERE 
  key_id = '3b623ee7f332e9146a66596226ac6de16526d20b33426c2c430cc54693b9a50d' 
  AND (
    token = 'bniIwxMvAGlX+ucLSRNHENWjkrH/K2eaoN4JSoCVFUM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037