UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D3Ey58pri451oua9hFXIY8Y/bIW+YS5dWsmkNj6mKII=' 
WHERE 
  key_id = '931e148c00b9039b58a7e54887bb4b29c35f92544d81e14fa1aca30a3c87f60d' 
  AND (
    token = 'D3Ey58pri451oua9hFXIY8Y/bIW+YS5dWsmkNj6mKII=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027