UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YIhJZPcluQrEmIZxJZbbyK0IL+i6FjPg0SsPmlwm6Z8=' 
WHERE 
  key_id = 'f3d54c6eb1ec9f90b970c767086a6ed8497412ec05f80a9171018feb81dbae2c' 
  AND (
    token = 'YIhJZPcluQrEmIZxJZbbyK0IL+i6FjPg0SsPmlwm6Z8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028