UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'V4C4FZ+daF1masqxb238GiMP4oOMTHYK07ikAgcoBjo=' 
WHERE 
  key_id = '063fbce58ca4ec6dc423bbb372653d6023b2db6d2e81a0dd9869cdde5788867d' 
  AND (
    token = 'V4C4FZ+daF1masqxb238GiMP4oOMTHYK07ikAgcoBjo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032