UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cvJ0a6b9TdUKm50JAp6qgZImqe4BA+5GjIlqvmflWdo=' 
WHERE 
  key_id = '8d4f4f9763e5925f7587d3216170445e9c280136f7908b2a8dadad77bdf8f30c' 
  AND (
    token = 'cvJ0a6b9TdUKm50JAp6qgZImqe4BA+5GjIlqvmflWdo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021