UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XddXqVjMtZX7OZb/Iv0mpkNyS6pThjXKRBR7ss3mkII=' 
WHERE 
  key_id = '42f9ac5647fb5a86998ed6a86414d2395aea4ae1d3c8840f5b19dfe3a1d7968b' 
  AND (
    token = 'XddXqVjMtZX7OZb/Iv0mpkNyS6pThjXKRBR7ss3mkII=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048