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

Query time 0.00016