UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Y6tDKO8ATvg2Oit1MJrgC01OMRtlqh4LYeW8cnrNX/M=' 
WHERE 
  key_id = '495e9730d587d24e69587254c66fa293d198f26cf994b67421dda08889434467' 
  AND (
    token = 'Y6tDKO8ATvg2Oit1MJrgC01OMRtlqh4LYeW8cnrNX/M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036