UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rH/JjXNkborw6Ksdczqgkig/C2VN+9E5fOh5vzgAi6c=' 
WHERE 
  key_id = '1079d579961d466dad2645a459826979dccfadeedbcb4a69151d33a8e7d97509' 
  AND (
    token = 'rH/JjXNkborw6Ksdczqgkig/C2VN+9E5fOh5vzgAi6c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00053