UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wPuk7jzIh203zlj8rlene6009HgLY4WzQm+RWzZ2sFk=' 
WHERE 
  key_id = '25e5df10253ba3c009a3bbc274263251fb8763a6c7a331bd8c8394ff0f651d4f' 
  AND (
    token = 'wPuk7jzIh203zlj8rlene6009HgLY4WzQm+RWzZ2sFk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018