UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HiaCiR9+OQD2eeF881vh2i+E1oxWSDHKut2cgtkvx6Y=' 
WHERE 
  key_id = 'd99913d25f8af4ce47ec6c4e95d69ae95916b5dbebd67b9719a10edd3074f407' 
  AND (
    token = 'HiaCiR9+OQD2eeF881vh2i+E1oxWSDHKut2cgtkvx6Y=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023