UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'sD5VUKNxq3GCBmdL5XiDOdXvTUaC7e7Xd/9dPX7aRFo=' 
WHERE 
  key_id = '3fbf05369864a454f9137b546a44a454d9ad31f53479402ac94be2fc174d3b68' 
  AND (
    token = 'sD5VUKNxq3GCBmdL5XiDOdXvTUaC7e7Xd/9dPX7aRFo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031