UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FF4VJIs4W9KwA8xp5wQWFn1CZIuqVdRaF2BbnMpFpNM=' 
WHERE 
  key_id = '8a71a5cf38bb14d372488d5442b73edb47a564031e1c5a92026092e11d17b499' 
  AND (
    token = 'FF4VJIs4W9KwA8xp5wQWFn1CZIuqVdRaF2BbnMpFpNM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041