UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'rgz0JyNvuFFfxzUlpQH34cX3vzHTRvJtCtBy5KJ2D3w=' 
WHERE 
  key_id = '78e637fee15910bec25f4ab70efa7176593552779f8fb92eb71d3d4a0b9b503a' 
  AND (
    token = 'rgz0JyNvuFFfxzUlpQH34cX3vzHTRvJtCtBy5KJ2D3w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032