UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bHKEGWKxsed7VfNvCmZ6RWtYrVG+1YXGAUrh+Sowa7c=' 
WHERE 
  key_id = 'a689f4b87c5b96f44f9f6cc24ee6077248faf6ff5b1dc395be2f15aa19691652' 
  AND (
    token = 'bHKEGWKxsed7VfNvCmZ6RWtYrVG+1YXGAUrh+Sowa7c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037