UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vZUREM8A3Aq9JWEQrVQgeDnCHhJbTGkteH+lVqonckU=' 
WHERE 
  key_id = 'a1dd544cee2dc8cca3f907f9c19098a0b8cc8f03a06c37b857d0cbd5dd54d799' 
  AND (
    token = 'vZUREM8A3Aq9JWEQrVQgeDnCHhJbTGkteH+lVqonckU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024