UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8pW9ZGjczbnbDIuQ7vNK238WFuYpaJhh4FWuIC9+Gsk=' 
WHERE 
  key_id = 'c7e97e3b5a4be4efc250e9f38a414a87da4e0bb330ba79b48e85b0fbced27028' 
  AND (
    token = '8pW9ZGjczbnbDIuQ7vNK238WFuYpaJhh4FWuIC9+Gsk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029