UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SguIQH31VIaALGmccYmIpsLB65jAJViv+rgMwZMTm/o=' 
WHERE 
  key_id = 'e85e6e324f2a3900293b9f9702b95ebcd48b3afb507e308471cfaeed2b43f37d' 
  AND (
    token = 'SguIQH31VIaALGmccYmIpsLB65jAJViv+rgMwZMTm/o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039