UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'nGytrfgFDGgwyciI9xE8sG74Ici5jSE0Z0dlZmyyA4c=' 
WHERE 
  key_id = '743b29033767fe35ceab91a7e537d898effe81b0e896751fe31018863a4cb4ab' 
  AND (
    token = 'nGytrfgFDGgwyciI9xE8sG74Ici5jSE0Z0dlZmyyA4c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037