UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kzbkf1MCtX4mvPeOPpTP7bAx+JA90AJnohEYhv5uiTM=' 
WHERE 
  key_id = '478831df2044bf4e8958cc4adcdb6c60dd05d804fab7929360d8198d1fddb17b' 
  AND (
    token = 'kzbkf1MCtX4mvPeOPpTP7bAx+JA90AJnohEYhv5uiTM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025