UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KBQQEx5QS3BF5u/B0p7BWak0osQFNRy9GyEkHp5b9+A=' 
WHERE 
  key_id = '4f6107cf269f607caf500e9c0f35a287b1c850d461ac7acd8b8efcd53551e008' 
  AND (
    token = 'KBQQEx5QS3BF5u/B0p7BWak0osQFNRy9GyEkHp5b9+A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025