UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dNoxX8hoWr8xWFHUMUn0P0z4hXYazkPrJq1ETcQYDfc=' 
WHERE 
  key_id = 'aacc08113686fb556d01ac3b9cd56d2daa51572676f39972716d36da2724a397' 
  AND (
    token = 'dNoxX8hoWr8xWFHUMUn0P0z4hXYazkPrJq1ETcQYDfc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036