UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Qwl7FpvHKRX5j0Bz5W7QCmGvBlYmlNrASjKkhFsThUc=' 
WHERE 
  key_id = '905c3853dbec0df4b069289311394b8d331cdd2b127bc50e4be98f20a2c36244' 
  AND (
    token = 'Qwl7FpvHKRX5j0Bz5W7QCmGvBlYmlNrASjKkhFsThUc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033