UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'uaHB28KaNWvvVPmOKtezx4st7FnNC7c0WI7LPq61Aew=' 
WHERE 
  key_id = 'e383075d7241c5c79bbb782ec3df1fe9893d8e5826e04448214f4810bd1502de' 
  AND (
    token = 'uaHB28KaNWvvVPmOKtezx4st7FnNC7c0WI7LPq61Aew=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029