UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HGY0FeVSX84eEiY+bqdFnuHgBMvh8jb0B0WISsmzdVs=' 
WHERE 
  key_id = '0d7ee34dae195b3c556ffecbc4d1de7c72152d20d63367568c70664b32e2e931' 
  AND (
    token = 'HGY0FeVSX84eEiY+bqdFnuHgBMvh8jb0B0WISsmzdVs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040