UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'w9YGSfzGEaMf7wi5JHnMU2oCNKJtxGPv0Hmp40N1/RM=' 
WHERE 
  key_id = '578c4eb23f549778e944932498658563a621be438d0d1cd688f0fdf09d66c397' 
  AND (
    token = 'w9YGSfzGEaMf7wi5JHnMU2oCNKJtxGPv0Hmp40N1/RM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018