UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3ny6F9geEQhGTsmMNsB5g2GE0lksa7QfHiZrE7cpbc8=' 
WHERE 
  key_id = '23c389ff549fd595bc756132793ff40a59d38a6ac1cd8cc2e91b361e517bde52' 
  AND (
    token = '3ny6F9geEQhGTsmMNsB5g2GE0lksa7QfHiZrE7cpbc8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040