UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q37xoS/K3BjzqAc+gPxb2tZLhyUaj0qTADZqu910Ib4=' 
WHERE 
  key_id = '20da487f1283f6ec82210218b748727675708a83178f14d01bd658ffb154fe26' 
  AND (
    token = 'Q37xoS/K3BjzqAc+gPxb2tZLhyUaj0qTADZqu910Ib4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00015