UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GY+0vahwiiSxPJzR4wP4+MxSq0HOfph/PfSafK/C4Ms=' 
WHERE 
  key_id = '3d4c86cb0866c70283f922d65eef72089c383e81baa6678d5ef4f8f190078770' 
  AND (
    token = 'GY+0vahwiiSxPJzR4wP4+MxSq0HOfph/PfSafK/C4Ms=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027