UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '5ds9hZmsUGIq9kzpAO6zWGEI74qwz98/xrijZh3qTqU=' 
WHERE 
  key_id = '87b79f4339eb331b024a610589a1b595704321677738ba74b38a08bc6e607916' 
  AND (
    token = '5ds9hZmsUGIq9kzpAO6zWGEI74qwz98/xrijZh3qTqU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034