UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Cgrj5TMpjlcTeiB7NHqD4nHWdWqwPwPw489uzkuPU54=' 
WHERE 
  key_id = '3941410c70ab606b39f7769971fb3900f267e9b109442734bfa715643e172eba' 
  AND (
    token = 'Cgrj5TMpjlcTeiB7NHqD4nHWdWqwPwPw489uzkuPU54=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024