UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'riz3aMBh1Hj2WShnb8yg9oFfQLDQa211s2TeQoFmxdQ=' 
WHERE 
  key_id = '84ce1812a6bb8d80883affc298d6abe66ca8245f375b75e9b66f62156d0adb12' 
  AND (
    token = 'riz3aMBh1Hj2WShnb8yg9oFfQLDQa211s2TeQoFmxdQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025