UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D9FtvYeR8lcIGnpNU9GOrGvPf3EcYN7onAmZ9Aw22sE=' 
WHERE 
  key_id = 'b041dab7fe87f02b187706483b4ef12abdbcf91df6487884332c36f5e8305946' 
  AND (
    token = 'D9FtvYeR8lcIGnpNU9GOrGvPf3EcYN7onAmZ9Aw22sE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026