UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5+eC+9YmWoFFrUfnLgu4OrYGpQEJWOU1+rgT5yFvsvk=' 
WHERE 
  key_id = '62505e2bb545f4a44c93643696a7c36b443691916d1f42e080d5947f931030a7' 
  AND (
    token = '5+eC+9YmWoFFrUfnLgu4OrYGpQEJWOU1+rgT5yFvsvk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035