UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'X+Z2M56VqGKqC1ahbEffRzcRvlGlwem88yFmaq7U9r8=' 
WHERE 
  key_id = '86bfda98c9ead9b51d1b0cbbed4372445f9c289098384a9501eff776b27433bc' 
  AND (
    token = 'X+Z2M56VqGKqC1ahbEffRzcRvlGlwem88yFmaq7U9r8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022