UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '9kmk607PXjv9vpA0H1cG0WmeVk46LG9aRSM1091wA6w=' 
WHERE 
  key_id = '9e1f2a4562b5a52a7406f645a58d5fb01c2ed5aa7c4322c529901d37999fd2e1' 
  AND (
    token = '9kmk607PXjv9vpA0H1cG0WmeVk46LG9aRSM1091wA6w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041