UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SbHIybzRf4RFuyLvSolMc1tIhfqg+D2qzACMoas2HwM=' 
WHERE 
  key_id = '3ede5cd8b053596d700d3c9d8c76666e29e50845b0f6152cf857b9f20be3298c' 
  AND (
    token = 'SbHIybzRf4RFuyLvSolMc1tIhfqg+D2qzACMoas2HwM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018